#include "StdAfx.h"
#include "VoiceTalkStateIdle.h"
#include "TalkObject.h"
#include "AnalogTrunk.h"
#include "VoiceTalkObject.h"
#include "TinyServerDefine.h"

namespace TalkProcess {
CVoiceTalkStateIdle::CVoiceTalkStateIdle(void)
{
}

CVoiceTalkStateIdle::~CVoiceTalkStateIdle(void)
{
}
void CVoiceTalkStateIdle::ProcessReceivedMsg(CTinyMsg& inMsg,CTinyMsg& OutMsg)
{
	if(inMsg.getMsgIndex() == VOICECARD_ACTION)
	{
		switch (inMsg.getMsgItem())
		{
		case VOICECARD_ALERT:
			{
			//if right, prepare to change state to connected;
			HAL::CAnalogTrunk* trunk = g_DevicePool.GetTrunkByID((dynamic_cast<CVoiceTalkObject*>(this->talkObjectHandle))->calledID);
			if(trunk != NULL)
			{
				trunk->pickup();
			}
			//this->talkObjectHandle->changeState(VoiceTalk_State_Connected);
			break;
			}
		default:
			break;
		}
	}
}
}